DESCRIPTION = "systemd networkd config"

LICENSE = "CLOSED"

do_configure[noexec] = "1"
do_compile[noexec] = "1"
do_install[nostamp] += "1"

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += " \
    file://10-eth0-static.network \
	file://20-eth0-dynamic.network \
	file://10-eth1-static.network \	
	file://20-eth1-dynamic.network \
"

S = "${WORKDIR}"

INSANE_SKIP_${PN} += "arch"

do_install () {
	install -d ${D}${sysconfdir}/systemd/network/static
	install -d ${D}${sysconfdir}/systemd/network/dynamic
    install -m 0644 ${S}/10-eth0-static.network ${D}${sysconfdir}/systemd/network/static
	install -m 0644 ${S}/10-eth1-static.network ${D}${sysconfdir}/systemd/network/static
	install -m 0644 ${S}/20-eth0-dynamic.network ${D}${sysconfdir}/systemd/network/dynamic
	install -m 0644 ${S}/20-eth1-dynamic.network ${D}${sysconfdir}/systemd/network/dynamic
	ln -sf ${sysconfdir}/systemd/network/static/10-eth0-static.network \
					${D}${sysconfdir}/systemd/network/10-eth0.network
	ln -sf ${sysconfdir}/systemd/network/dynamic/20-eth1-dynamic.network \
					${D}${sysconfdir}/systemd/network/20-eth1.network
}

PACKAGES = "${PN}"
RDEPENDS_${PN} += "systemd"

FILES_${PN} = " \
		${sysconfdir}/systemd/network/static/10-eth0-static.network \
		${sysconfdir}/systemd/network/static/10-eth1-static.network \
		${sysconfdir}/systemd/network/dynamic/20-eth0-dynamic.network \
		${sysconfdir}/systemd/network/dynamic/20-eth1-dynamic.network \
		${sysconfdir}/systemd/network/10-eth0.network \
		${sysconfdir}/systemd/network/20-eth1.network \
"
